# -*- coding:utf-8 -*-
__author__ = 'weikai'
import  copy
#lNSeqNo=index="1" #保险数组的序列号
#lCCvrgNo="036001" #保险编号
#lNAmt="229415.00" #车辆金额
#lCDductMrk="369004"#不计免赔 如果没有设置为空 交强险的为空
#lNDductRate="0.15" #不知道什么参数 交强险为空 其他为0.15
#lNAmt_be="500000"
#seats=5
#insuredAmount,seats
def get_insurance_type(insuranceType,lNAmt,seats):
    seats =int(seats)
    '''"dataObjVoList": ['''
    dataObjVoList=[]
    attributeVoList='''
    {
        "index": "1",
        "selected": "true",
        "status": "INSERTED",
        "attributeVoList": [
          {
            _-a"_-lCCancelMrk",
            _-b"0"
          },
          {
            _-a"_-lNSeqNo",
            _-b"${lNSeqNo}"
          },
          {
            _-a"_-lCPkId",
            _-b""
          },
          {
            _-a"_-lCCvrgNo",
            _-b"${lCCvrgNo}"
          },
          {
            _-a"_-lNAmt",
            _-b"${lNAmt}"
          },
          {
            _-a"_-lCDductMrk",
            _-b"${lCDductMrk}"
          },
          {
            _-a"_-lNBasePrm",
            _-b""
          },
          {
            _-a"_-lNPrm",
            _-b""
          },
          {
            _-a"_-lNPerAmt",
            _-b""
          },
          {
            _-a"_-lNLiabDaysLmt",
            _-b""
          },
          {
            _-a"_-lNIndemLmt",
            _-b""
          },
          {
            _-a"_-lNRate",
            _-b"0"
          },
          {
            _-a"_-lCRowId",
            _-b""
          },
          {
            _-a"_-lCCrtCde",
            _-b""
          },
          {
            _-a"_-lTCrtTm",
            _-b""
          },
          {
            _-a"_-lNDeductible",
            _-b""
          },
          {
            _-a"_-lCUpdCde",
            _-b""
          },
          {
            _-a"_-lTUpdTm",
            _-b""
          },
          {
            _-a"_-lTBgnTm",
            _-b""
          },
          {
            _-a"_-lTEndTm",
            _-b""
          },
          {
            _-a"_-lNDisCoef",
            _-b""
          },
          {
            _-a"_-l_-s30",
            _-b""
          },
          {
            _-a"_-l_-s29",
            _-b""
          },
          {
            _-a"_-l_-s12",
            _-b""
          },
          {
            _-a"_-l_-s1",
            _-b""
          },
          {
            _-a"_-lCIndemLmtLvl",
            _-b""
          },
          {
            _-a"_-lNDductRate",
            _-b"0.15"
          },
          {
            _-a"_-l_-u1",
            _-b""
          },
          {
            _-a"_-lNPerPrm",
            _-b""
          },
          {
            _-a"_-lNDductPrm",
            _-b""
          },
          {
            _-a"_-lNBefPrm",
            _-b""
          },
          {
            _-a"_-lNVhlActVal",
            _-b"${lNVhlActVal}"
          }
        ]
      }
    '''



    if insuranceType.get("glassBrokenPremium","0")=="1":
        glassBrokenPremium=copy.deepcopy(attributeVoList)
        glassBrokenPremium['attributeVoList'][1]={"_-lNSeqNo":"6"}
        glassBrokenPremium['attributeVoList'][3]={"_-lCCvrgNo":"036006"}
        glassBrokenPremium['attributeVoList'][4]={"_-lNAmt":""}
        glassBrokenPremium['attributeVoList'][11]={"_-lNRate":"0"}
        glassBrokenPremium['attributeVoList'][26]={"_-lNDductRate":""}
        glassBrokenPremium['attributeVoList'][21]={"_-l_-s30":"303011001"}
        glassBrokenPremium['attributeVoList'][22]={"_-l_-s29":"0"}
        glassBrokenPremium['index']="6"
        dataObjVoList.append(glassBrokenPremium)


    if insuranceType.get("carFirePremium","0")=="1":
        carFirePremium=copy.deepcopy(attributeVoList)
        carFirePremium['attributeVoList'][1]={"_-lNSeqNo":"7"}
        carFirePremium['attributeVoList'][3]={"_-lCCvrgNo":"036007"}
        carFirePremium['attributeVoList'][4]={"_-lNAmt":lNAmt}
        carFirePremium['attributeVoList'][11]={"_-lNRate":"2"}
        carFirePremium['attributeVoList'][26]={"_-lNDductRate":"0.2"}
        carFirePremium['attributeVoList'][31]={"_-lNVhlActVal":lNAmt}
        carFirePremium['index']="7"
        if insuranceType.get("carFireBrokenBenchMarkPremium","0")=="1":
            carFirePremium['attributeVoList'][5]={"_-lCDductMrk":"369003"}
        else:
            carFirePremium['attributeVoList'][5]={"_-lCDductMrk":""}
        dataObjVoList.append(carFirePremium)

    #attributeVoList['attributeVoList'][31]={"_-lNVhlActVal":""}

    if insuranceType.get("engineWadingPremium","0")=="1":
        engineWadingPremium=copy.deepcopy(attributeVoList)
        engineWadingPremium['attributeVoList'][1]={"_-lNSeqNo":"12"}
        engineWadingPremium['attributeVoList'][3]={"_-lCCvrgNo":"036012"}
        engineWadingPremium['attributeVoList'][4]={"_-lNAmt":""}
        engineWadingPremium['attributeVoList'][11]={"_-lNRate":"2"}
        engineWadingPremium['attributeVoList'][26]={"_-lNDductRate":"0.2"}
        engineWadingPremium['index']="12"
        if insuranceType.get("engineWadingBenchMarkPremium","")=="1":
            engineWadingPremium['attributeVoList'][5]={"_-lCDductMrk":"369003"}
        else:
            engineWadingPremium['attributeVoList'][5]={"_-lCDductMrk":""}
        dataObjVoList.append(engineWadingPremium)

    if insuranceType.get("carTheftPremium","0")=="1":
        carTheftPremium=copy.deepcopy(attributeVoList)
        carTheftPremium['attributeVoList'][1]={"_-lNSeqNo":"5"}
        carTheftPremium['attributeVoList'][3]={"_-lCCvrgNo":"036005"}
        carTheftPremium['attributeVoList'][4]={"_-lNAmt":lNAmt}
        carTheftPremium['attributeVoList'][11]={"_-lNRate":"0"}
        carTheftPremium['attributeVoList'][26]={"_-lNDductRate":"0.2"}
        carTheftPremium['index']="5"
        if insuranceType.get("carTheftBenchMarkPremium","0")=="1":
            carTheftPremium['attributeVoList'][5]={"_-lCDductMrk":"369003"}
        else:
            carTheftPremium['attributeVoList'][5]={"_-lCDductMrk":""}
        dataObjVoList.append(carTheftPremium)
    # # 车辆损失保险
    if insuranceType.get("carDamagePremium","0")=="1":
        carDamagePremium=copy.deepcopy(attributeVoList)
        carDamagePremium['attributeVoList'][1]={"_-lNSeqNo":"1"}
        carDamagePremium['attributeVoList'][3]={"_-lCCvrgNo":"036001"}
        carDamagePremium['attributeVoList'][4]={"_-lNAmt":lNAmt}
        carDamagePremium['attributeVoList'][11]={"_-lNRate":"0"}
        carDamagePremium['attributeVoList'][26]={"_-lNDductRate":"0.15"}
        carDamagePremium['index']="1"
        if insuranceType.get("carDamageBenchMarkPremium","0")=="1":
            carDamagePremium['attributeVoList'][5]={"_-lCDductMrk":"369003"}
        else:
            carDamagePremium['attributeVoList'][5]={"_-lCDductMrk":""}
        dataObjVoList.append(carDamagePremium)

    #第三方责任险
    if insuranceType.get("otherHurtPremium",{}).get("isCheck","0")=="1":
        otherHurtPremium=copy.deepcopy(attributeVoList)
        otherHurtPremium['attributeVoList'][0]={"_-lCCancelMrk":"0"}
        otherHurtPremium['attributeVoList'][1]={"_-lNSeqNo":"2"}
        otherHurtPremium['attributeVoList'][3]={"_-lCCvrgNo":"036002"}
        otherHurtPremium['attributeVoList'][4]={"_-lNAmt":insuranceType.get("otherHurtPremium",{}).get("Amount","500000")}
        otherHurtPremium['attributeVoList'][10]={"_-lNIndemLmt":insuranceType.get("otherHurtPremium",{}).get("Amount","500000")}
        otherHurtPremium['attributeVoList'][25]={"_-lCIndemLmtLvl":"306006009"}
        otherHurtPremium['attributeVoList'][26]={"_-lNDductRate":"0.15"}
        otherHurtPremium['index']="2"
        if insuranceType.get("otherHurtBenchMarkPremium","0")=="1":
            otherHurtPremium['attributeVoList'][5]={"_-lCDductMrk":"369003"}
        else:
            otherHurtPremium['attributeVoList'][5]={"_-lCDductMrk":""}
        dataObjVoList.append(otherHurtPremium)

    if insuranceType.get("carNickPremium",{}).get("isCheck","0")=="1":
        carNickPremium=copy.deepcopy(attributeVoList)
        carNickPremium['attributeVoList'][0]={"_-lCCancelMrk":"0"}
        carNickPremium['attributeVoList'][1]={"_-lNSeqNo":"13"}
        carNickPremium['attributeVoList'][3]={"_-lCCvrgNo":"036013"}
        carNickPremium['attributeVoList'][4]={"_-lNAmt":insuranceType.get("carNickPremium",{}).get("Amount","2000")}
        carNickPremium['attributeVoList'][8]={"_-lNPerAmt":""}#保费
        carNickPremium['attributeVoList'][10]={"_-lNIndemLmt":insuranceType.get("carNickPremium",{}).get("Amount","2000")}#保费
        carNickPremium['attributeVoList'][9]={"_-lNLiabDaysLmt":""}
        carNickPremium['attributeVoList'][25]={"_-lNDductRate":"N03001001"}
        carNickPremium['attributeVoList'][26]={"_-lNDductRate":"0.15"}
        carNickPremium['index']="13"
        if insuranceType.get("carNickBenchMarkPremium","0")=="1":
            carNickPremium['attributeVoList'][5]={"_-lCDductMrk":"369003"}
        else:
            carNickPremium['attributeVoList'][5]={"_-lCDductMrk":""}
        dataObjVoList.append(carNickPremium)



    if insuranceType.get("driverDutyPremium",{}).get("isCheck","0")=="1":
        driverDutyPremium=copy.deepcopy(attributeVoList)
        #insuranceType.get("driverDutyPremium",{}).get("Amount","10000")
        driverDutyPremium['attributeVoList'][0]={"_-lCCancelMrk":"0"}
        driverDutyPremium['attributeVoList'][1]={"_-lNSeqNo":"3"}
        driverDutyPremium['attributeVoList'][3]={"_-lCCvrgNo":"036003"}
        driverDutyPremium['attributeVoList'][4]={"_-lNAmt":"0"}
        driverDutyPremium['attributeVoList'][8]={"_-lNPerAmt":insuranceType.get("driverDutyPremium",{}).get("Amount","10000")}#保费
        driverDutyPremium['attributeVoList'][9]={"_-lNLiabDaysLmt":"1"}
        driverDutyPremium['attributeVoList'][26]={"_-lNDductRate":"0.15"}
        driverDutyPremium['index']="3"
        if insuranceType.get("driverDutyBenchMarkPremium","0")=="1":
            driverDutyPremium['attributeVoList'][5]={"_-lCDductMrk":"369003"}
        else:
            driverDutyPremium['attributeVoList'][5]={"_-lCDductMrk":""}
        dataObjVoList.append(driverDutyPremium)

    if insuranceType.get("passengerDutyPremium",{}).get("isCheck","0")=="1":
        #passengerDutyPremium['insuredAmount']=int(insuranceType.get("passengerDutyPremium",{}).get("Amount","10000"))
        #passengerDutyPremium["seats"]=seats-1
        passengerDutyPremium=copy.deepcopy(attributeVoList)
        passengerDutyPremium['attributeVoList'][0]={"_-lCCancelMrk":"0"}
        passengerDutyPremium['attributeVoList'][1]={"_-lNSeqNo":"4"}
        passengerDutyPremium['attributeVoList'][3]={"_-lCCvrgNo":"036004"}
        passengerDutyPremium['attributeVoList'][4]={"_-lNAmt":"0"}
        passengerDutyPremium['attributeVoList'][8]={"_-lNPerAmt":insuranceType.get("passengerDutyPremium",{}).get("Amount","10000")}#保费
        passengerDutyPremium['attributeVoList'][9]={"_-lNLiabDaysLmt":str(seats-1)}
        passengerDutyPremium['attributeVoList'][26]={"_-lNDductRate":"0.15"}
        passengerDutyPremium['index']="4"
        if insuranceType.get("passengerBenchMarkPremium","0")=="1":
            passengerDutyPremium['attributeVoList'][5]={"_-lCDductMrk":"369003"}
        else:
            passengerDutyPremium['attributeVoList'][5]={"_-lCDductMrk":""}
        dataObjVoList.append(passengerDutyPremium)
    #交通强制险
    if insuranceType.get("compulsoryInsurance","1")=="1":
        #passengerDutyPremium['insuredAmount']=int(insuranceType.get("passengerDutyPremium",{}).get("Amount","10000"))
        #passengerDutyPremium["seats"]=seats-1
        compulsoryInsurance=copy.deepcopy(attributeVoList)
        compulsoryInsurance['attributeVoList'][0]={"_-lCCancelMrk":"0"}
        compulsoryInsurance['attributeVoList'][1]={"_-lNSeqNo":"21"}
        compulsoryInsurance['attributeVoList'][3]={"_-lCCvrgNo":"033201"}
        compulsoryInsurance['attributeVoList'][4]={"_-lNAmt":"122000"}
        compulsoryInsurance['attributeVoList'][8]={"_-lNPerAmt":""}
        compulsoryInsurance['attributeVoList'][9]={"_-lNLiabDaysLmt":""}
        compulsoryInsurance['attributeVoList'][26]={"_-lNDductRate":""}
        compulsoryInsurance['index']="21"
        dataObjVoList.append(compulsoryInsurance)

    return dataObjVoList


if __name__=="__main__":
     insuranceType = {
        'compulsoryInsurance': "1",  # 交通事故强制责任险
        'nAggTax': '1',  # 车船税

        'otherHurtPremium': {"isCheck": "1", "Amount": "500000"},  # 第三者责任保险
       'carNickPremium': {"isCheck": "1", "Amount": "2000"},  # 车身划痕损失险
        'driverDutyPremium': {"isCheck": "1", "Amount": "10000"},  # 车上人员责任保险（司机）
        'passengerDutyPremium': {"isCheck": "1", "Amount": "10000"},# 车上人员责任保险（乘客）

        'glassBrokenPremium': "1",  # 玻璃单独破碎险(国产)
        'carFirePremium': "1",  # 自燃损失险
        'engineWadingPremium': "1",  # 发动机涉水损失险
        'carTheftPremium': "1",  # 全车盗抢保险
        'carDamagePremium': "1",  # 车辆损失保险
        'carDamageBenchMarkPremium': '1',  # 不计免赔——车辆损失保险
        'otherHurtBenchMarkPremium': '1',  # 不计免赔——第三者责任保险
        'carTheftBenchMarkPremium': '1',  # 不计免赔——全车盗抢保险
        'driverDutyBenchMarkPremium': '1',  # 不计免赔——车上人员责任保险（司机）
        'passengerBenchMarkPremium': '1',  # 不计免赔——车上人员责任保险（乘客）
       'carNickBenchMarkPremium': '1',  # 不计免赔——车身划痕损失险
        'carFireBrokenBenchMarkPremium': '1',  # 不计免赔——自燃损失险
        'engineWadingBenchMarkPremium': '1'  # 不计免赔——发动机涉水损失险
         }

     print get_insurance_type(insuranceType,"8888.00","5")